//package com.sunop.pantiai.service;
//
//import com.aliyun.ocr_api20210707.Client;
//import com.aliyun.ocr_api20210707.models.RecognizeAllTextRequest;
//import com.aliyun.ocr_api20210707.models.RecognizeAllTextResponse;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.web.multipart.MultipartFile;
//
//import java.io.ByteArrayInputStream;
//
//@Service
//public class AliyunOcrService {
//
//    @Autowired
//    private Client ocrClient;
//
//    public String recognizeFile(MultipartFile file) throws Exception {
//        RecognizeAllTextRequest request = new RecognizeAllTextRequest()
//                .setType("Advanced")
//                .setBody(new ByteArrayInputStream(file.getBytes()))
//                .setOutputOricoord(true);
//
//        RecognizeAllTextRequest.RecognizeAllTextRequestAdvancedConfig advancedConfig = new RecognizeAllTextRequest.RecognizeAllTextRequestAdvancedConfig()
//                .setOutputCharInfo(true);
//        request.setAdvancedConfig(advancedConfig);
//
//        // 使用正确的方法名
//        RecognizeAllTextResponse response = ocrClient.recognizeAllText(request);
//        return response.getBody().getData().toString();
//    }
//}
